package org.huawei260.TiKu.ODsuanfa;

import java.util.Arrays;
import java.util.Scanner;
public class B_2023B_3001__双指针_太阳能航天器 {

//	public class Main {
		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);

			int[] heights = Arrays.stream(sc.nextLine().split(",")).mapToInt(Integer::parseInt).toArray();

			System.out.println(getResult(heights));
		}

		public static long getResult(int[] heights) {
			int l = 0;
			int r = heights.length - 1;
			long maxArea = 0;

			while (l < r) {
				long x = r - l;
				long y = heights[l] < heights[r] ? heights[l++] : heights[r--];
				maxArea = Math.max(maxArea, x * y);
			}

			return maxArea;
		}
	}